package org.dtrd.modules.record.entity.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.dtrd.common.util.DateUtils;
import org.dtrd.modules.record.entity.po.DtrdEntRdSigninHeightWeight;

import java.util.Date;

/**
 * 身高体重Bean
 *
 * @author lizhongcheng
 * @since 2015-12-10
 */
@Data
@ApiModel(value = "身高体重BMI")
public class HeightBean implements java.io.Serializable {
    private static final long serialVersionUID = 5735101445398038894L;
    /**
     * 定义本类的私有变量
     */
    @ApiModelProperty("记录id")
    private Integer id;

    @ApiModelProperty(value = "测量状态", notes = "空腹-1、非空腹-2")
    private Integer status;

    @ApiModelProperty("身高")
    private Float height;

    @ApiModelProperty("体重")
    private Float weight;

    @ApiModelProperty("记录时间")
    private String time;

    @ApiModelProperty("记录日期")
    private String date;

    @ApiModelProperty("备注")
    private String remark;

    @ApiModelProperty("bmi")
    private Float bmi;

    @ApiModelProperty("patientId")
    private Integer patientId;

    @ApiModelProperty("体脂率")
    private Float bodyFat;

    @ApiModelProperty("记录照片")
    private String recordPhoto;

    public HeightBean() {
    }

    public HeightBean(Integer patientId, Date date, Float weight, Float height) {
        this.patientId = patientId;
        this.time = DateUtils.formatDate(date, DateUtils.datetimeFormat.get().toPattern());
        this.weight = weight;
        this.height = height;
    }

    public HeightBean parseFromPo(DtrdEntRdSigninHeightWeight po) {
        id = po.getDataId();
        patientId = po.getPatientId();
        height = po.getHeightWeightHeight();
        weight = po.getHeightWeightWeight();
        bmi = po.getHeightWeightBmi();
        remark = po.getHeightWeightRemark();
        recordPhoto = po.getRecordPhoto();
        bodyFat = po.getHeightWeightBodyFat();
        date = DateUtils.formatDate(po.getRecordDate());
        time = DateUtils.formatDateTime(po.getRecordTime());
        status = po.getRecordType();
        return this;
    }
}